package com.epam.giorgadze.task4.Factory;

import com.epam.giorgadze.task4.Entity.Book;
import com.epam.giorgadze.task4.Entity.Library;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * User: Luka
 * Date: 23.03.14
 * Time: 19:12
 */
public class LibraryFactory {
    static List<String> bookNameList = new ArrayList<String>();
    static List<String> bookAuthorList = new ArrayList<String>();
    static List<Integer> idList = new ArrayList<Integer>();

    static {
        bookNameList.add("45");
        bookNameList.add("White fang");
        bookNameList.add("Portrait of Dorian Grey");
        bookNameList.add("Martin Iden");
        bookNameList.add("The Old Man and the Sea");
        bookNameList.add("The catcher in the Rye");
        bookNameList.add("The Great Gatsby");
        bookAuthorList.add("A. Duma");
        bookAuthorList.add("J. London");
        bookAuthorList.add("Oscar Wilde");
        bookAuthorList.add("J. London");
        bookAuthorList.add("E. Hemingway");
        bookAuthorList.add("J. Salindger");
        bookAuthorList.add("F. Fitgerald");
        idList.add(154212);
        idList.add(185689);
        idList.add(354562);
        idList.add(465287);
        idList.add(564284);
        idList.add(986458);
        idList.add(231564);
    }

    public static Library createLibrary(int i) {
        LinkedList<Book> list = new LinkedList<Book>();
        for (int j = 0; j < i; j++) {
            Book book = new Book(idList.get(j),bookNameList.get(j),bookAuthorList.get(j));
            list.add(book);
        }
        Library<Book> pool = new Library<Book>(list);
        return pool;
    }


}
